<?php // $Id: index.php,v 1.7.2.2 2009/03/31 13:07:21 mudrd8mz Exp $
error_reporting(E_ALL);
/**
 * This page lists all the instances of ltcd in a particular course
 *
 * @author  Your Name <your@email.address>
 * @version $Id: index.php,v 1.7.2.2 2009/03/31 13:07:21 mudrd8mz Exp $
 * @package mod/ltcd
 */


require_once(dirname(dirname(__FILE__)).'/config.php');
require_once(dirname(__FILE__).'/lib.php');
require_once(dirname(__FILE__).'/lconfig.php');
require_once(dirname(__FILE__).'/Form.class.php');

print_header($strlicense, $strlicense, $navigation, "", "", false, "&nbsp;", "&nbsp;");
//Check if module is configured yet...
if(!isset($LCFG) || !($LCFG instanceOf Object) || $LCFG->username == '' || $LCFG->password == ''){
	error('This module needs to be configured before you can use it! <a style="font-weight:bold;" href="config_ltcd.php">click here to configure it!</a>');
}

//Show available options
//Get courses and groups
$groups = get_records("groups");

foreach($groups as $group){
	$grp[$group->id] = $group->name;	
}

//Header
?>

<h1>Welcome to the LTCD &lt;-&gt; Moodle Sync module!</h1>

<h2>Create a class in LTCD from a group in Moodle</h2>
<?php
//Create the form
$Form = new SimpleCcForm('usersync.php','post','Create class');
$Form->addField('text', 'LTCD username:', array('username',''),"Every user is going to be added under your LTCD account...");
$Form->addField('password', 'LTCD password:', array('password',''));
$Form->addField('text', 'LTCD class name:', array('classname',''),"This will be the name of your new class. We'll use the name of the selected group if you leave this field empty...");
$Form->addField('select', 'Group:', array('group',$grp,0),"Every user of this group is going to be copied into your new class in LTCD...");
echo $Form->generate('table');

print_footer('none');


?>
